Skip to content

feat(ENG-14143): adding checks for colour and interactivity suppression - #402

Open
coillteoir wants to merge 1 commit into
masterfrom
pr402
Open

feat(ENG-14143): adding checks for colour and interactivity suppression#402
coillteoir wants to merge 1 commit into
masterfrom
pr402

Conversation

@coillteoir

@coillteoir coillteoir commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Adding checks in the CLI to supporess ANSI output and interactive prompts

ANSI suppression

  1. Check for non-empty NO_COLOUR flag
  2. Check for CS_FORCE_TTY flag to enable colour
  3. Check for TERM=dumb

@coillteoir
coillteoir force-pushed the pr402 branch 5 times, most recently from 9d3fa67 to 1bb052f Compare September 2, 2026 14:36
@coillteoir
coillteoir force-pushed the pr402 branch 5 times, most recently from 82ccabb to 9d50d11 Compare September 2, 2026 15:44
@coillteoir
coillteoir marked this pull request as ready for review September 3, 2026 13:24
@coillteoir
coillteoir requested a review from a team as a code owner September 3, 2026 13:24
Copilot AI lite review requested due to automatic review settings September 3, 2026 13:24
@coillteoir
coillteoir force-pushed the pr402 branch 2 times, most recently from b161f51 to 0794fb2 Compare September 3, 2026 13:27

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces core utility helpers intended to control ANSI color output and interactive prompting based on environment variables and explicit mode settings, with accompanying unit tests to validate precedence rules.

Changes:

  • Added ColorMode / TTYMode enums plus color_enabled() and is_interactive() helpers in cloudsmith_cli/core/utils.py.
  • Added a new test module to exercise environment-variable precedence for color and interactivity suppression.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 4 comments.

File Description
cloudsmith_cli/core/utils.py Adds enums and helper functions to determine whether color and interactive behavior should be enabled.
cloudsmith_cli/core/tests/test_terminal_color.py Adds parametrized tests covering environment-variable precedence for color/interactivity suppression.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread cloudsmith_cli/core/utils.py
Comment thread cloudsmith_cli/core/utils.py
Comment thread cloudsmith_cli/core/utils.py Outdated
Comment thread cloudsmith_cli/core/tests/test_terminal_color.py Outdated
Adding checks in the CLI to supporess ANSI output and interactive prompts

## ANSI suppression
1. Check for non-empty `NO_COLOUR` flag
2. Check for `CLOUDSMITH_FORCE_COLOR` flag to enable colour
3. Check for TERM=dumb

# Prompt suppression
1. Check for CI=true env var
2. Respect shell TTY conditions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants